package com.hrg.rds.infra.connect.protocol.s7;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

@Getter
public enum S7MemoryArea {
	C("COUNTERS"),
	T("TIMERS"),
	D("DIRECT_PERIPHERAL_ACCESS"),
	I("INPUTS"),
	Q("OUTPUTS"),
	M("FLAGS_MARKERS"),
	DB("DATA_BLOCKS"),
	DBI("INSTANCE_DATA_BLOCKS"),
	LD("LOCAL_DATA")
	;

	S7MemoryArea(String name) {
		this.name = name;
	}
	private final String name;
	private static final Map<String, S7MemoryArea> map = new HashMap<>();

	static {
		for (S7MemoryArea s7MemoryArea : S7MemoryArea.values()) {
			map.put(s7MemoryArea.name, s7MemoryArea);
		}
	}

	public static S7MemoryArea get(String name) {
		return map.get(name);
	}
}
